package com.sinosoft.front;

import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import com.sinosoft.front.dto.common.xsd.TxInsuranceRequestEhm;
import com.sinosoft.front.dto.common.xsd.TxInsuranceRequestExtensionEhm;
import com.sinosoft.front.dto.xsd.ProvisonalStatusRequest;
import com.sinosoft.front.dto.xsd.ProvisonalStatusResponse;
import com.sinosoft.front.service.ProvisonalStatusQueryServicePortType;
import com.sinosoft.front.service.ProvisonalStatusQueryServicePortTypeProxy;

public class ProvisonalStatusQueryTest {

	public static void main(String[] args) throws RemoteException, ServiceException, MalformedURLException {
		//调用服务器端方法 订单查询服务
		ProvisonalStatusQueryServicePortTypeProxy proxy = new ProvisonalStatusQueryServicePortTypeProxy();
		proxy.setEndpoint("http://proxy.tuxing51.com/frontServiceCenter/services/ProvisonalStatusQueryService?wsdl");
		ProvisonalStatusQueryServicePortType portType = proxy.getProvisonalStatusQueryServicePortType();
		
		
		//请求头信息
		ProvisonalStatusRequest request = new ProvisonalStatusRequest();
		TxInsuranceRequestEhm requestEhm = new TxInsuranceRequestEhm();
		requestEhm.setTransExeDate("2017-3-17");
		requestEhm.setTransExeTime("12:24:34");
		request.setTxInsuranceRequestEhm(requestEhm);
		
		//requestEhm.setIinsuranceExtensionEhm(new IinsuranceExtensionEhm());
	
		//请求头数据
		TxInsuranceRequestExtensionEhm extensionEhm = new TxInsuranceRequestExtensionEhm();
		extensionEhm.setOperator("HN1_Test");
		extensionEhm.setOperatorKey("123456");
		request.setTxInsuranceRequestExtensionEhm(extensionEhm );
		
		
		//入口参数
		request.setPolicySort("HN1");
		request.setProvisonalNo("1234567899");//订单暂存号
		
//		ProvisonalStatusQueryService service=new ProvisonalStatusQueryServiceLocator();
//		java.net.URL url = new java.net.URL("http://proxy.tuxing51.com/frontServiceCenter/services/ProvisonalStatusQueryService?wsdl");
//		ProvisonalStatusQueryServiceSoap11BindingStub stub = new ProvisonalStatusQueryServiceSoap11BindingStub(url, service);
//		ProvisonalStatusResponse response = stub.queryProvisonalStatus(request);
		
		
		ProvisonalStatusResponse response = portType.queryProvisonalStatus(request);
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getResultCode());
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getResultInfoDesc());
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getErrorNo());
		
		//获取返回信息
		
		
		

	}

}
